package com.zzq.base.awesome.api.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.zzq.base.awesome.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zzq.base.awesome.entity.Role;
import com.zzq.base.awesome.entity.UserDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

/**
* <p>
* zzq
* </p>
* @author 赵自强
* @since 2020-02-09
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("security_user")
@ApiModel(value="User对象", description="")
public class User extends BaseEntity implements UserDetail, Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "账户号  可以用来登录")
    @TableField("account")
    private String account;

    @ApiModelProperty(value = "用户昵称")
    @TableField("username")
    private String username;

    @ApiModelProperty(value = "用户登录密码")
    @TableField("password")
    private String password;

    @ApiModelProperty(value = "用户邮箱 可以用来登录")
    @TableField("email")
    private String email;

    @ApiModelProperty(value = "用户手机号  可以用来登录")
    @TableField("telephone")
    private String telephone;

    @ApiModelProperty(value = "头像图片的地址")
    @TableField("avatar")
    private String avatar;

    @ApiModelProperty(value = "1是管理员 2是学生")
    @TableField("type")
    private int type;

    @TableField(exist = false)
    private Role role;

    @Override
    public String getSign() {
        return String.valueOf(this.id);
    }

    public String getSignString(){
        return account + username + password + email + telephone + type;
    }
}
